package com.fanqiechaodan.command;

/**
 * @author fanqiechaodan
 * @Classname ConcreteCommand
 * @Description 具体命令对象1
 */
public class ConcreteCommand1 implements Command {

    private Receiver receiver;
    private boolean isExecute;

    public ConcreteCommand1(Receiver receiver) {
        this.receiver = receiver;
    }


    /**
     * 执行
     */
    @Override
    public void execute() {
        receiver.action1();
        isExecute = true;
    }

    /**
     * 撤销
     */
    @Override
    public void undo() {
        if (isExecute) {
            receiver.undoAction1();
            isExecute = false;
        }
    }
}
